<?php $this->load->view(TEMPLATE_NAME.'/front/header'); ?>
<?php $this->load->view(TEMPLATE_NAME.'/front/side_left'); ?>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script src="<?php echo base_url(); ?>js/jquery.NobleCount.min.js"></script>
<script src="<?php echo base_url(); ?>js/ajaxfileupload.js"></script>
<script src="<?php echo base_url(); ?>js/si.files.js"></script>
<script type="text/javascript" language="javascript">
    SI.Files.stylizeAll();
function ajaxFileUpload(get_this){
    var this_id = get_this.id.split('_');
    var div_load = "#loading_" + this_id[1];
     
    $(div_load)
    .ajaxStart(function(){
        $(this).show();
    })
    .ajaxComplete(function(){
        $(this).hide();
        $(this).unbind("ajaxStart");
    });    
    
    var img = '#img_' + this_id[1];
    $.ajaxFileUpload({
        url:'<?php echo site_url('ajax_upload/upload_directory_image/upload/news_photo')?>/file/'+get_this.id,
        secureuri:false,       
        fileElementId: get_this.id,
        dataType: 'json',
        success: function (data, status){
            if(typeof(data.error) != 'undefined'){
                if(data.error != ''){                    
                    $(img).html(data.error);
                }else{                        
                    $(img).html('<img src="<?php echo base_url();?>/uploads/news_photo/'+data.msg+'" width="550pox" height="410px" /><br />'
                    +'<input type="hidden" name="upload" value="'+data.msg +'">');
                }
            }
        },
        error: function (data, status, e){
            $(span).html(e);
        }
    });
	
}
</script>
<style type="text/css" title="text/css">
.SI-FILES-STYLIZED label.cabinet
{
    width: 100px;
    height: 28px;
    background: url(<?php echo base_url()?>image/select_news.jpg) 0 0 no-repeat;
    display: block;
    overflow: hidden;
    cursor: pointer;
    margin:-18px 0 -14px 120px;
    padding:5px 30px;
    /*margin-left:30px*/;
}

.SI-FILES-STYLIZED label.cabinet input.file
{
    position: relative;
    height: 100%;
    width: auto;
    opacity: 0;
    -moz-opacity: 0;
    filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);
}
</style>
<div class="page">
<?php 
$imagename = $this->News_model->getnewsimage($id);
//Please remove static from the img tag if the image is not showing
?>
<h2>Post News </h2>
<!--<div class="clear"></div>-->
<?php $this->load->view(TEMPLATE_NAME.'/front/news_header'); ?>
<!--<div class="clear"></div>-->
<!--<div>--><p class="phase"><strong>Photos</strong> - Include Photos with your News - <span class="purple">(Optional)</span></p> <!--</div>-->
<!--<div style="float:left; width:150px">--><!--</div> -->
<!--<div style="float:right"><span class="purple"><a href="<?php echo site_url('news/news_photos/') ?>">> Back to Photos</a></span></div> -->
<a href="<?php echo site_url('news/news_photos/') ?>" class="r f14">&gt; Back to Photos</a>
<strong class="f13">Edit Photos</strong>
<hr />
<!--<div class="clear"></div>-->
<!--<div>--> <!--container -->

<?php $attributes = array('class' => 'posts longs2'); 
echo form_open_multipart('news/news_photos',$attributes); ?>
<div class="center">
<div id="img_1"><!--to show image style="text-align:center"-->
<img  src="<?php echo base_url();?>/uploads/news_photo/thumb/<?php echo $imagename[0]['news_image'] ?> " width="550px"  />
</div>
</div>
<hr />
<!--<span class="purple">--><strong class="purple">Replace Image: </strong> <!--</span>-->
<label class="cabinet" style="">
    <input name="file_1" class="file" type="file" id="file_1" onchange="return ajaxFileUpload(this);"/>
    <input type="hidden" name="prev_image" id="prev_image" value="<?php echo $imagename[0]['news_image'] ?>" />
    <input type="hidden" name="imageid" id="imageid" value="<?php echo $id ?>">
</label>
<img id="loading_1" src="<?php echo base_url()?>image/loading_blue.gif" style="display:none;position:absolute;z-index:1000;left:20px;top:50px" />
<!--</div>--><hr />
<!--<div id="forcaption">
<span class="purple">-->
<strong class="purple">Edit Caption:</strong> <!--</span>--><br />
<textarea name="imagecaption" id="imagecaption"><?php echo $imagename[0]['image_caption'] ?></textarea>
<!--</div> -->
<hr style="margin:0" />
<?php echo form_submit('photoreplace', 'Submit'); ?>
<?php echo form_close(); ?>
<!--</div>-->
<!--<div class="clear"></div>-->
    <?php $this->load->view(TEMPLATE_NAME.'/front/footer_menu');?>
</div><!-- page -->

<?php $this->load->view(TEMPLATE_NAME.'/front/side_right');?> 
<?php $this->load->view(TEMPLATE_NAME.'/front/footer');?> 